/* handle ajax info */

var xmlhttp

/* individual game performance */
function showGameStatic(userID){

    
    xmlhttp=GetXmlHttpObject();
    if (xmlhttp==null)
    {
        alert ("Your browser does not support XMLHTTP!");
        return;
    }

    var puzzleID= document.getElementById("pid").value;
    var url="UserGameStatistics.jsp";
    url=url+"?uid="+userID;
    url=url+"&pid="+puzzleID;

    xmlhttp.onreadystatechange=stateChanged;
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}

/* show game overall performance & improvement */

function showPerformanceStatic(){

    xmlhttp=GetXmlHttpObject();
    if (xmlhttp==null)
    {
        alert ("Your browser does not support XMLHTTP!");
        return;
    }

    var difficult= document.getElementById("pid").value;
    var url="PerformanceStatistics.jsp?pid=" + difficult;

    xmlhttp.onreadystatechange=stateChanged;
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}

function showWebSudoku(){

    xmlhttp=GetXmlHttpObject();
    if (xmlhttp==null)
    {
        alert ("Your browser does not support XMLHTTP!");
        return;
    }

    var langmode= document.getElementById("lid").value;
    var url="WebSudoku.jsp?lid=" + langmode;

    xmlhttp.onreadystatechange=stateChanged;
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}


function stateChanged()
{
if (xmlhttp.readyState==4)
  {
  document.getElementById("result").innerHTML=xmlhttp.responseText;
  }
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}
